All Functions Used So Far, Week 8

filter

{dplyr}

Filter out rows of a data frame according to logical vector

seq

{base}

Create a sequence

mean

{base}

Get mean of a vector

cut

{base}

Convert Numeric to Factor

library

{base}

Load an R package

sd

{stats}

Get standard deviation of a vector

is.na

{base}

Check if a value is NA/elements of vector are NA

as.numeric

{base}

Coerce a vector to numeric

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

ggplot

{GGPLOT2}

Create a ggplot graph

labs

{GGPLOT2}

Customise labels in GGPLOT2

levels

{base}

Get levels of a factor

separate

{dplyr}

Separate a character column into multiple columns

read_excel

{readxl}

Read an Excel file

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

summary

{base}

Obtain summary statistics or detailed regression output

names

{base}

Retrieve names of a list/vector

ordered

{dplyr}

Create an ordered factor

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

save

{base}

Writes an external representation of R objects to the specified file.

mutate

{dplyr}

Modify/create a column in a data frame

select

{dplyr}

Select columns from a tibble/data frame

ifelse

{base}

Return a or b depending on the value of test

write_dta

NA

read_dta

{haven}

Read a .dta file (Stata data)

str

{utils}

Get the structure of an R object

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

slice

{dplyr}

Subset rows using their positions

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

desc

{dplyr}

Arrange in descending order

boxplot

{graphics}

Plot a simple box plot

recode

{dplyr}

Recode a variable

summarize

NA

max

{base}

Get maximum of a vector

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

median

{stats}

Get median of a vector

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

data.frame

{base}

Create a data.frame from vectors

hist

{graphics}

Plot a simple histogram

n

{dplyr}

The number of observations in the current group.

var

{stats}

Calculate variance

ungroup

{dplyr}

Resolve grouping created with “group_by”

head

{utils}

Show first 5 rows of a data frame

setwd

{base}

Set Working Directory

c

{base}

Combine values/vectors into a vector

range

{base}

Return range of values

spread

{tidyr}

Spread a key-value pair across multiple columns

factor

{base}

Create a factor

sum

{base}

Get sum of numeric values or a vector

min

{base}

Get minimum of a vector

write.csv

{utils}

write a csv file to a data frame

as.character

{base}

Coerce a vector to character

geom_histogram

{GGPLOT2}

Generates a histogram

The end!